Source for file environment.php
Documentation is available at environment.php
* This file groups classes pertaining to execution environment.
* @author Antoine d'Otreppe de Bouvette <a.dotreppe@aspyct.org>
* @license http://www.opensource.org/licenses/mit-license.php
* Offers read-only properties related to application context.
* This class offers read-only properties named after the existing createXxx
* methods. A "createConfig" method would offer a "config" attribute.
* These "createXxx" methods will be called only once, so that each represent
* This is useful for providing a global access to main application resources
* like configuration, request objects and such.
* Some methods are provided as a default behaviour.
* Contains the previously created properties.
private $props = array();
* Returns the object/scalar/array/whatever created by the method
* "createXxx" where "Xxx" = ucfirst($attr). If no such method exists, a
* ContextException is thrown.
public function __get($attr) {
$method = array($this, 'create' . ucfirst($attr));
'No attribute "' . $attr . '" in context.');
return $this->props[$attr];
* Provides access to request parameters.
* Returns the request method, uppercased.
* Returns the GET parameter corresponding to $key, or $default if this key
function get($key, $default= Null);
* Returns the POST parameter corresponding to $key, or $default if this key
function post($key, $default= Null);
* A request that fits a standard web environment.
* See {@link Request} for method details.
* @see WebCommons/Request::method()
* @see WebCommons/Request::post()
public function post($key, $default= Null) {
* @see WebCommons/Request::get()
public function get($key, $default= Null) {
* Exception thrown when a requested attribute is missing in a Context object.
|